<?php
namespace AbstractFactoryPattern;

class FactoryProducer {
    public function getFactory($type) {
    // public function getFactory($type) : AbstractFacory 加上返回类型才是抽象工厂设计模式的关键
        if ('shape' == $type) {
            return new ShapeFactory();
        } elseif ('color' == $type) {
            return new ColorFactory();
        }
        return null;
    
    }
}


?>
